package com.ruoyi.quartz.task;

import com.ruoyi.market.http.service.MarketApiService;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.ehcache.EhCacheManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务调度测试
 * 
 * @author ruoyi
 */
@Component("speApiResultTask")
public class SpeApiResultTask
{

    @Autowired
    MarketApiService marketApiService;
    @Autowired
    private EhCacheManager ehCacheManager;

    public void queryApiResult()
    {

        System.out.println();
        System.out.println();
        System.out.println("==================定时任务执行===========================");
        System.out.println();
        System.out.println();

        Cache<String, String> testCache = ehCacheManager.getCache("testCache");

        String time = testCache.get("time");
        System.out.println(time);

        testCache.put("time", String.valueOf(System.currentTimeMillis()));

        System.out.println();
        System.out.println();

        marketApiService.querySpeApiResult();
    }
}
